﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Text.RegularExpressions;
namespace JCW.Common
{
    /// <summary>
    /// 字符串相关特殊处理辅助类
    /// </summary>
    public static class StringHelper
    {
        #region 秒数转为时间
        /// <summary>
        /// 秒数转为时间
        /// </summary>
        /// <param name="pSecond">秒数</param>
        /// <returns>时间数</returns>
        public static string DisplayDateTimeCountBySecond(long pSecond)
        {
            StringBuilder oStringBuilder = new StringBuilder();

            //大于一天，显示天
            if (pSecond >= 60 * 60 * 24)
            {
                oStringBuilder.Append(string.Format("{0:F0}", pSecond / 86400));
                oStringBuilder.Append("天");
                pSecond = pSecond % (86400);
            }

            //一天内，显示小时
            if (pSecond > 3600 || pSecond == 0)
            {
                oStringBuilder.Append(string.Format("{0:F0}", pSecond / 3600));
                oStringBuilder.Append("小时");
                pSecond = pSecond % (3600);
            }

            //一小时内，显示分
            if (pSecond > 60 || pSecond == 0)
            {
                oStringBuilder.Append(string.Format("{0:F0}", pSecond / 60));
                oStringBuilder.Append("分");
                pSecond = pSecond % (60);
            }

            //一分钟内，显示秒
            if (pSecond < 60)
            {
                oStringBuilder.Append(pSecond.ToString());
                oStringBuilder.Append("秒");
            }

            return oStringBuilder.ToString();
        }
        #endregion

        #region 毫秒数转为时间
        /// <summary>
        /// 秒数转为时间
        /// </summary>
        /// <param name="pMillisecond">秒数</param>
        /// <returns>时间数</returns>
        public static string DisplayDateTimeCountByMillisecond(long pMillisecond)
        {
            StringBuilder oStringBuilder = new StringBuilder();

            pMillisecond = int.Parse(string.Format("{0:F0}", pMillisecond / 1000));

            //大于一天，显示天
            if (pMillisecond >= 60 * 60 * 24)
            {
                oStringBuilder.Append(string.Format("{0:F0}", pMillisecond / 86400));
                oStringBuilder.Append("天");
                pMillisecond = pMillisecond % (86400);
            }

            //一天内，显示小时
            if (pMillisecond > 3600 || pMillisecond == 0)
            {
                oStringBuilder.Append(string.Format("{0:F0}", pMillisecond / 3600));
                oStringBuilder.Append("小时");
                pMillisecond = pMillisecond % (3600);
            }

            //一小时内，显示分
            if (pMillisecond > 60 || pMillisecond == 0)
            {
                oStringBuilder.Append(string.Format("{0:F0}", pMillisecond / 60));
                oStringBuilder.Append("分");
                pMillisecond = pMillisecond % (60);
            }

            //一分钟内，显示秒
            if (pMillisecond < 60)
            {
                oStringBuilder.Append(pMillisecond.ToString());
                oStringBuilder.Append("秒");
            }

            return oStringBuilder.ToString();
        }
        #endregion

        #region 全角符号转半角符号函数
        /// <summary>
        /// 全角符号转半角符号函数
        /// </summary>
        /// <param name="pStr">待替换的字符</param>
        /// <returns>替换出的字符</returns>
        public static string SBCConvertToDBC(string pStr)
        {
            pStr = pStr.Replace("！", "!");
            pStr = pStr.Replace("（", "(");
            pStr = pStr.Replace("）", ")");
            pStr = pStr.Replace("，", ",");
            pStr = pStr.Replace("。", ".");
            pStr = pStr.Replace("？", "?");
            pStr = pStr.Replace("：", ":");
            pStr = pStr.Replace("；", ";");
            pStr = pStr.Replace("‘", "'");
            pStr = pStr.Replace("’", "'");
            pStr = pStr.Replace("　", " ");
            return pStr;
        }
        #endregion

        #region 半角符号转全角符号函数
        /// <summary>
        /// 半角符号转全角符号函数
        /// </summary>
        /// <param name="pStr">待替换的字符</param>
        /// <returns>替换出的字符</returns>
        public static string DBCConvertToSBC(string pStr)
        {
            pStr = pStr.Replace("!", "！");
            pStr = pStr.Replace("(", "（");
            pStr = pStr.Replace(")", "）");
            pStr = pStr.Replace(",", "，");
            pStr = pStr.Replace(".", "。");
            pStr = pStr.Replace("?", "？");
            pStr = pStr.Replace(":", "：");
            pStr = pStr.Replace(";", "；");
            pStr = pStr.Replace("\"", "“");
            pStr = pStr.Replace("'", "‘");
            pStr = pStr.Replace(" ", "　");
            return pStr;
        }
        #endregion

        #region 普通文本转HTML函数
        /// <summary>
        /// 普通文本转HTML函数
        /// </summary>
        /// <param name="str">源字符串</param>
        /// <returns>已转换字符串</returns>
        public static string TextToHTML(string str)
        {
            string TextData = str;
            TextData = TextData.Replace("\r\n", "<br/>");
            TextData = TextData.Replace("\n", "<br/>");
            return TextData;
        }
        #endregion

        #region 普通文本转JavaScript代码函数
        /// <summary>
        /// 普通文本转JavaScript代码函数
        /// </summary>
        /// <param name="sr">源字符串</param>
        /// <returns>已转换字符串</returns>
        public static string TextToJSCode(string str)
        {
            string TextData = str;
            TextData = TextData.Replace("\\", "\\\\");
            TextData = TextData.Replace("'", "\\'");
            TextData = TextData.Replace("\r\n", "<br>");
            TextData = TextData.Replace("\n", "<br>");
            TextData = TextData.Replace("\r", "");
            return TextData;
        }
        #endregion

        #region 普通文本转TooltipMessage函数
        /// <summary>
        /// 普通文本转TooltipMessage函数
        /// </summary>
        /// <param name="str">源字符串</param>
        /// <returns>已转换字符串</returns>
        public static string TextToTooltipMessage(string str)
        {
            //处理
            string TextData = str;
            TextData = TextData.Replace("(", "（");
            TextData = TextData.Replace(")", "）");
            TextData = TextData.Replace(";", "；");
            TextData = TextData.Replace("\r\n", "<br/>");
            TextData = TextData.Replace("\n", "");
            TextData = TextData.Replace("\r", "");
            TextData = TextData.Replace("\"", "''");
            TextData = TextData.Replace("\t", "　　　　");
            TextData = TextData.Replace("'", "''");
            TextData = TextData.Replace("\\", "\\\\");
            return TextData;
        }
        #endregion

        //正则表达式函数

        #region 获取正则节点函数
        /// <summary>
        /// 获取正则节点函数
        /// </summary>
        /// <param name="pRegexString">正则表达式字符串，如：[UserID]3434[/UserID][CreateDateTime]1900-01-01 01:01:01[/CreateDateTime]</param>
        /// <param name="pNode">节点名</param>
        /// <returns>结果字符串</returns>
        public static string GetRegexNode(string pRegexString, string pNode)
        {
            StringBuilder strRegex = new StringBuilder();
            Regex oRegex;
            Match oMatch;

            //构造表达式
            strRegex.Append(@"\[").Append(pNode).Append(@"\](.*)\[/");
            strRegex.Append(pNode).Append(@"\]");
            oRegex = new Regex(strRegex.ToString(), RegexOptions.IgnoreCase | RegexOptions.Compiled);
            oMatch = oRegex.Match(pRegexString);
            if (oMatch.Success)
            {
                return oMatch.Groups[1].Value;
            }
            else
            {
                return "";
            }
        }
        #endregion

        #region 设置正则节点函数
        /// <summary>
        /// 设置正则节点函数
        /// </summary>
        /// <param name="pRegexString">正则表达式字符串，如：[UserID]3434[/UserID][CreateDateTime]1900-01-01 01:01:01[/CreateDateTime]</param>
        /// <param name="pNode">节点名</param>
        /// <param name="pNodeValue">节点值</param>
        /// <returns>结果字符串</returns>
        public static string SetRegexNode(string pRegexString, string pNode, string pNodeValue)
        {
            StringBuilder strRegex = new StringBuilder();
            Regex oRegex;
            Match oMatch;

            //构造表达式
            strRegex.Append(@"\[").Append(pNode).Append(@"\](.*)\[/");
            strRegex.Append(pNode).Append(@"\]");
            oRegex = new Regex(strRegex.ToString(), RegexOptions.IgnoreCase | RegexOptions.Compiled);
            oMatch = oRegex.Match(pRegexString);
            if (oMatch.Success)
            {
                return pRegexString.Replace("[" + pNode + "]" + oMatch.Groups[1].Value + "[/" + pNode + "]", "[" + pNode + "]" + pNodeValue + "[/" + pNode + "]");
            }
            else
            {
                return pRegexString;
            }
        }
        #endregion

        #region 格式化正则节点函数
        /// <summary>
        /// 格式化正则节点函数
        /// </summary>
        /// <param name="pNode">节点名</param>
        /// <param name="pNodeValue">节点值</param>
        /// <returns>结果字符串</returns>
        public static string FormateRegexNode(string pNode, string pNodeValue)
        {
            return "[" + pNode + "]" + pNodeValue + "[/" + pNode + "]";
        }
        #endregion

        #region 格式化正则节点函数 [Hashtable]
        /// <summary>
        /// 格式化正则节点函数 [Hashtable]
        /// </summary>
        ///<param name="pHashtable">哈希对象</param>
        /// <returns>结果字符串</returns>
        public static string FormateRegexNode(Hashtable pHashtable)
        {
            IDictionaryEnumerator NodeItem = pHashtable.GetEnumerator();
            string RegexString = "";
            while (NodeItem.MoveNext())
            {
                RegexString += FormateRegexNode(NodeItem.Key.ToString(), NodeItem.Value.ToString());
            }
            return RegexString;
        }
        #endregion

        #region UBB字符转换成HTML字符
        /// <summary>
        /// UBB字符转换成HTML字符
        /// </summary>
        /// <param name="Str">源字符串</param>
        /// <returns>转换后的字符串</returns>
        public static string UBBToHTML(string Str)
        {
            Str = Str.Replace(" ", "&nbsp;");
            Str = Str.Replace("\n", "<br>");
            Str = Regex.Replace(Str, @"\[url=(?<x>[^\]]*)\](?<y>[^\]]*)\[/url\]", @"<a href=$1 target=_blank>$2</a>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[url\](?<x>[^\]]*)\[/url\]", @"<a href=$1 target=_blank>$1</a>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[email=(?<x>[^\]]*)\](?<y>[^\]]*)\[/email\]", @"<a href=mailto:$1>$2</a>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[email\](?<x>[^\]]*)\[/email\]", @"<a href=mailto:$1>$1</a>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[img](?<x>[^\]]*)\[/img]", @"<IMG SRC=""$1"" border=0>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[color=(?<x>[^\]]*)\](?<y>[^\]]*)\[/color\]", @"<font color=$1>$2</font>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[face=(?<x>[^\]]*)\](?<y>[^\]]*)\[/face\]", @"<font face=$1>$2</font>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[size=1\](?<x>[^\]]*)\[/size\]", @"<font size=1>$1</font>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[size=2\](?<x>[^\]]*)\[/size\]", @"<font size=2>$1</font>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[size=3\](?<x>[^\]]*)\[/size\]", @"<font size=3>$1</font>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[size=4\](?<x>[^\]]*)\[/size\]", @"<font size=4>$1</font>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[size=5\](?<x>[^\]]*)\[/size\]", @"<font size=5>$1</font>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[size=6\](?<x>[^\]]*)\[/size\]", @"<font size=6>$1</font>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[align=(?<x>[^\]]*)\](?<y>[^\]]*)\[/align\]", @"<align=$1>$2</align>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[fly](?<x>[^\]]*)\[/fly]", @"<marquee width=90% behavior=alternate scrollamount=3>$1</marquee>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[move](?<x>[^\]]*)\[/move]", @"<marquee scrollamount=3>$1</marquee>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[glow=(?<y>[^\]]*),(?<z>[^\]]*)\](?<w>[^\]]*)\[/glow\]", @"<table width='100%' style=""filter:glow(color='$1', strength='$2')""><tr><td>$3</td></tr></table>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[shadow=(?<y>[^\]]*),(?<z>[^\]]*)\](?<w>[^\]]*)\[/shadow\]", @"<table width=='100%' style=""filter:shadow(color='$1', strength='$2')""><tr><td>$3</td></tr></table>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[center\](?<x>[^\]]*)\[/center\]", @"<center>$1</center>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[b\](?<x>[^\]]*)\[/b\]", @"<b>$1</b>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[i\](?<x>[^\]]*)\[/i\]", @"<i>$1</i>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[u\](?<x>[^\]]*)\[/u\]", @"<u>$1</u>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[code\](?<x>[^\]]*)\[/code\]", @"<pre id=code><font size=1 face='Verdana, Arial' id=code>$1</font id=code></pre id=code>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[list\](?<x>[^\]]*)\[/list\]", @"<ul>$1</ul>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[list=1\](?<x>[^\]]*)\[/list\]", @"<ol type=1>$1</ol id=1>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[list=a\](?<x>[^\]]*)\[/list\]", @"<ol type=a>$1</ol id=a>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[\*\](?<x>[^\]]*)\[/\*\]", @"<li>$1</li>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[quote](?<x>.*)\[/quote]", @"<center>—— 以下是引用 ——<table border='1' width='80%' cellpadding='10' cellspacing='0' ><tr><td>$1</td></tr></table></center>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[QT\](.[^\[]*)\[\/QT]", @"<embed src=$1 width=500 height=350 autoplay=true loop=false controller=true playeveryframe=false cache=false scale=TOFIT bgcolor=#000000 kioskmode=false targetcache=false pluginspage=http://www.apple.com/quicktime/>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[MP\](.[^\[]*)\[\/MP]", @"<object align=middle classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95 class=OBJECT id=MediaPlayer width=500 height=350 ><param name=ShowStatusBar value=-1><param name=AUTOSTART value=false><param name=Filename value=$1><embed type=application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 flename=mp src=$3 width=$1 height=$2></embed></object>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[RM\](.[^\[]*)\[\/RM]", @"<OBJECT classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA class=OBJECT id=RAOCX width=500 height=350><PARAM NAME=SRC VALUE=$1><PARAM NAME=CONSOLE VALUE=Clip1><PARAM NAME=CONTROLS VALUE=imagewindow><PARAM NAME=AUTOSTART VALUE=false></OBJECT><br><OBJECT classid=CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA height=32 id=video2 width=$1><PARAM NAME=SRC VALUE=$1><PARAM NAME=AUTOSTART VALUE=-1><PARAM NAME=CONTROLS VALUE=controlpanel><PARAM NAME=CONSOLE VALUE=Clip1></OBJECT>", RegexOptions.IgnoreCase);
            Str = Regex.Replace(Str, @"\[flash](?<x>[^\]]*)\[/flash]", @"<OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 width=500 height=350><PARAM NAME=movie VALUE=""$1""><PARAM NAME=quality VALUE=high><embed src=""$1"" quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width=500 height=400>$1</embed></OBJECT>", RegexOptions.IgnoreCase);
            Str = Str.Replace("[:1]", "<img src='../lib/images/icon_smile_1.gif' border=0 align=middle>");
            Str = Str.Replace("[:2]", "<img src='../lib/images/icon_smile_2.gif' border=0 align=middle>");
            Str = Str.Replace("[:3]", "<img src='../lib/images/icon_smile_3.gif' border=0 align=middle>");
            Str = Str.Replace("[:4]", "<img src='../lib/images/icon_smile_4.gif' border=0 align=middle>");
            Str = Str.Replace("[:5]", "<img src='../lib/images/icon_smile_5.gif' border=0 align=middle>");
            Str = Str.Replace("[:6]", "<img src='../lib/images/icon_smile_6.gif' border=0 align=middle>");
            Str = Str.Replace("[:7]", "<img src='../lib/images/icon_smile_7.gif' border=0 align=middle>");
            Str = Str.Replace("[:8]", "<img src='../lib/images/icon_smile_8.gif' border=0 align=middle>");
            Str = Str.Replace("[:9]", "<img src='../lib/images/icon_smile_9.gif' border=0 align=middle>");
            Str = Str.Replace("[:10]", "<img src='../lib/images/icon_smile_10.gif' border=0 align=middle>");
            Str = Str.Replace("[:11]", "<img src='../lib/images/icon_smile_11.gif' border=0 align=middle>");
            Str = Str.Replace("[:12]", "<img src='../lib/images/icon_smile_12.gif' border=0 align=middle>");
            Str = Str.Replace("[:13]", "<img src='../lib/images/icon_smile_13.gif' border=0 align=middle>");
            Str = Str.Replace("[:14]", "<img src='../lib/images/icon_smile_14.gif' border=0 align=middle>");
            Str = Str.Replace("[:15]", "<img src='../lib/images/icon_smile_15.gif' border=0 align=middle>");
            Str = Str.Replace("[:16]", "<img src='../lib/images/icon_smile_16.gif' border=0 align=middle>");
            Str = Str.Replace("[:17]", "<img src='../lib/images/icon_smile_17.gif' border=0 align=middle>");
            Str = Str.Replace("[:18]", "<img src='../lib/images/icon_smile_18.gif' border=0 align=middle>");
            Str = Str.Replace("[:19]", "<img src='../lib/images/icon_smile_19.gif' border=0 align=middle>");
            Str = Str.Replace("[:20]", "<img src='../lib/images/icon_smile_20.gif' border=0 align=middle>");
            Str = Str.Replace("[:21]", "<img src='../lib/images/icon_smile_21.gif' border=0 align=middle>");
            Str = Str.Replace("[:22]", "<img src='../lib/images/icon_smile_22.gif' border=0 align=middle>");
            Str = Str.Replace("[:23]", "<img src='../lib/images/icon_smile_23.gif' border=0 align=middle>");
            Str = Str.Replace("[:24]", "<img src='../lib/images/icon_smile_24.gif' border=0 align=middle>");
            return Str;
        }
        #endregion

        //字符串处理函数

        #region 分割字符串
        /// <summary>
        /// 分割字符串
        /// </summary>
        /// <param name="strContent">待分割的字符串</param>
        /// <param name="strSplit">分割符</param>
        /// <returns>分割后的字符串数组</returns>
        public static string[] SplitString(string strContent, string strSplit)
        {
            if (strContent.IndexOf(strSplit) < 0)
            {
                string[] tmp = { strContent };
                return tmp;
            }
            return Regex.Split(strContent, @strSplit.Replace(".", @"\."), RegexOptions.IgnoreCase);
        }
        #endregion

        #region 截取指定长度的文本函数 [不过滤HTML]
        /// <summary>
        /// 截取指定长度的文本函数
        /// </summary>
        /// <param name="str">文本字符串</param>
        /// <param name="length">指定截断长度</param>
        /// <returns>文本前i个字符</returns>
        public static string CutText(string str, int length)
        {
            return CutText(str, length, false);
        }
        #endregion

        #region 截取指定长度的文本函数 [过滤HTML]
        /// <summary>
        /// 截取指定长度的文本函数 [过滤HTML]
        /// </summary>
        /// <param name="Length">指定截断长度</param>
        /// <param name="Str">文本字符串</param>
        /// <param name="Flag">是否保留html代码</param>
        /// <returns>文本前i个字符</returns>
        public static string CutText(string str, int length, bool flag)
        {
            return CutText(str, length, flag, "...");
        }
        #endregion

        #region 截取指定长度的文本函数 [是否过滤HTML][带附加字符串]
        /// <summary>
        /// 截取指定长度的文本函数 [过滤HTML]
        /// </summary>
        /// <param name="str">文本字符串</param>
        /// <param name="length">指定截断长度</param>
        /// <param name="flag">是否保留HTML代码</param>
        /// <param name="addString">附加字符串</param>
        /// <returns>文本前i个字符</returns>
        public static string CutText(string str, int length, bool flag, string addString)
        {
            //判断字符串长度是否大于截断长度
            if (System.Text.Encoding.Default.GetByteCount(str) > length)
            {
                //判断字串是否为空
                if (str == null)
                {
                    return string.Empty;
                }

                //初始化
                int i = 0, j = 0;

                //是否去除HTML代码
                if (flag == false)
                {
                    str = Regex.Replace(str, @"\<[^\<^\>]*\>", "");
                    str = str.Replace("&nbsp;", "");
                }

                //为汉字或全脚符号长度加2否则加1
                foreach (char Char in str)
                {
                    if ((int)Char > 127)
                    {
                        i += 2;
                    }
                    else
                    {
                        i++;
                    }
                    if (i > length)
                    {
                        if (addString != string.Empty)
                        {
                            str = str.Substring(0, j) + addString;
                        }
                        else
                        {
                            str = str.Substring(0, j);
                        }
                        break;
                    }
                    j++;
                }
            }
            return str;
        }
        #endregion

        #region 替换html字符
        /// <summary>
        /// 替换html字符
        /// </summary>
        /// <param name="strHtml">html字符串</param>
        /// <returns>转换后的字符串</returns>
        public static string EncodeHtml(string strHtml)
        {
            if (strHtml.Length > 0)
            {
                strHtml = strHtml.Replace(",", "&def");
                strHtml = strHtml.Replace("'", "&dot");
                strHtml = strHtml.Replace(";", "&dec");
                return strHtml;
            }
            return string.Empty;
        }
        #endregion

        #region 去除HTML标记
        /// <summary>
        /// 去除HTML标记
        /// </summary>
        /// <param name="strHtml">待处理的HTML字符串</param>
        /// <returns></returns>
        public static string ClearHtml(string strHtml)
        {
            if (strHtml != "")
            {
                Regex r = null;
                Match m = null;

                r = new Regex(@"<\/?[^>]*>", RegexOptions.IgnoreCase);
                for (m = r.Match(strHtml); m.Success; m = m.NextMatch())
                {
                    strHtml = strHtml.Replace(m.Groups[0].ToString(), "");
                }
            }
            return strHtml;
        }
        #endregion

        #region 删除字符串尾部的回车/换行/空格
        /// <summary>
        /// 删除字符串尾部的回车/换行/空格
        /// </summary>
        /// <param name="str">待处理的字符串</param>
        /// <returns></returns>
        public static string RTrim(string str)
        {
            for (int i = str.Length; i >= 0; i--)
            {
                if (str[i].Equals(" ") || str[i].Equals("\r") || str[i].Equals("\n"))
                {
                    str.Remove(i, 1);
                }
            }
            return str;
        }
        #endregion

        //其他

        #region Sql语句过滤
        /// <summary>
        /// Sql语句过滤
        /// </summary>
        /// <param name="str">原始SQL语句</param>
        /// <returns>过滤后的SQL语句</returns>
        public static string SqlFilter(string str)
        {
            //			//单引号替换成两个单引号
            //			source = source.Replace("'","''");
            //
            //			//半角封号替换为全角封号，防止多语句执行
            //			source = source.Replace(";","；");
            //
            //			//半角括号替换为全角括号
            //			source = source.Replace("(","（");
            //			source = source.Replace(")","）");

            str = str.Replace("'", "‘");

            str = str.Replace(",", "，");
            //str = str.Replace(";", "；");

            return str;


        }

        public static string SqlFilterForMysql(string str)
        {
            str = str.Replace("'", "''");
            return str;
        }

        /// <summary>
        /// 转义SQL语句特殊字符
        /// </summary>
        /// <param name="str">等处理字符串</param>
        /// <returns></returns>
        public static string SqlFilterKeyWord(string str)
        {
            if (str == null || str.Length == 0)
            {
                return string.Empty;
            }
            str = str.Replace("\0", "");
            str = str.Replace("\"", "\"");
            str = str.Replace("<", "<");
            str = str.Replace(">", ">");
            str = str.Replace("script", "script");
            str = str.Replace("SCRIPT", "SCRIPT");
            str = str.Replace("Script", "Script");
            str = str.Replace("script", "Script");
            str = str.Replace("object", "object");
            str = str.Replace("OBJECT", "OBJECT");
            str = str.Replace("Object", "Object");
            str = str.Replace("object", "Object");
            str = str.Replace("applet", "applet");
            str = str.Replace("APPLET", "APPLET");
            str = str.Replace("Applet", "Applet");
            str = str.Replace("applet", "Applet");
            str = str.Replace("[", "[");
            str = str.Replace("]", "]");
            str = str.Replace("\"", "");
            str = str.Replace("=", "=");
            str = str.Replace("'", "'");
            str = str.Replace("select", "select");
            str = str.Replace("execute", "execute");
            str = str.Replace("exec", "exec");
            str = str.Replace("join", "join");
            str = str.Replace("union", "union");
            str = str.Replace("where", "where");
            str = str.Replace("insert", "insert");
            str = str.Replace("delete", "delete");
            str = str.Replace("update", "update");
            str = str.Replace("like", "like");
            str = str.Replace("drop", "drop");
            str = str.Replace("create", "create");
            str = str.Replace("rename", "rename");
            str = str.Replace("count", "count");
            str = str.Replace("chr", "chr");
            str = str.Replace("mid", "mid");
            str = str.Replace("truncate", "truncate");
            str = str.Replace("nchar", "nchar");
            str = str.Replace("char", "char");
            str = str.Replace("alter", "alter");
            str = str.Replace("cast", "cast");
            str = str.Replace("exists", "exists");
            str = str.Replace("\r", "<br>");
            return str.Replace("'", "''");
        }

        /// <summary>
        /// 转义SQL内容还原
        /// </summary>
        /// <param name="str">等处理字符串</param>
        /// <returns></returns>
        public static string SqlFilterReversion(string str)
        {
            str = str.Replace(">", ">");
            str = str.Replace("<", "<");
            //str = str.Replace(CHR(34), "\""); //双引号 
            //str = str.Replace(CHR(39), "'"); //单引号  
            //str = str.Replace(CHR(32) & CHR(32), "  "); //空格 
            //str = str.Replace(CHR(9), " "); //tab键值  
            //str = str.Replace(CHR(10), "<br>"); //换行 
            //str = str.Replace(CHR(13), ""); //回车
            return str;
        }
        #endregion

        #region 检索子字符串[子字符串从指定的字符位置开始]
        /// <summary>
        /// 检索子字符串[子字符串从指定的字符位置开始]
        /// </summary>
        /// <param name="pStringByte">字节数组</param>
        /// <param name="pStr">字符串</param>
        /// <param name="pStartIndex">指定的字符位置</param>
        /// <param name="pLength">字符串长度</param>
        /// <param name="pCurIndex">检索字符的正确位置</param>
        /// <returns>符合要求的字符串</returns>
        public static string SubStringExt(byte[] pStringByte, string pStr, int pStartIndex, int pLength, out int pCurIndex)
        {
            int CurIndex = 0;
            int StartIndex = pStartIndex;
            int Length = pLength;
            string returnStr = string.Empty;
            byte[] StringByte = pStringByte;

            //记录英文、数字等个数
            int j = 0;

            if (StringByte.Length >= (Length + StartIndex))
            {
                for (int i = StartIndex; i < (StartIndex + Length); i++)
                {
                    if (i < StringByte.Length)
                    {
                        if (StringByte[i] > 127 && (StringByte.Length - i) >= 2)
                        {
                            //最后一个字符 如果单个英文、数字为奇数，则须进行处理保证图片统一大小
                            if (!(i >= (StartIndex + Length - 2) && (j % 2 > 0)))
                            {
                                returnStr += System.Text.Encoding.Default.GetString(StringByte, i, 2);
                            }
                            i++;

                        }
                        else if ((StringByte.Length - i) >= 1)
                        {
                            returnStr += System.Text.Encoding.Default.GetString(StringByte, i, 1);
                            j++;
                        }

                    }
                    CurIndex = i;
                }
            }

            //奇数
            if (j % 2 > 0)
            {
                pCurIndex = CurIndex - 1;
            }
            else
            {
                pCurIndex = CurIndex + 1;
            }


            return returnStr;
        }
        #endregion

        #region 生成随机字符串
        /// <summary>
        /// 生成随机字符串
        /// </summary>
        /// <param name="randomChars">字符串</param>
        /// <param name="randomLength">长度</param>
        /// <returns>随机串</returns>
        public static string RandText(string randomChars, int randomLength)
        {
            string text = "";
            int num = 0;
            if (randomLength >= randomChars.Length)
            {
                randomLength = randomChars.Length;
            }
            Random random = new Random((int)DateTime.Now.Ticks);
            for (int i = 0; i < randomLength; i++)
            {
                num = random.Next(randomChars.Length);
                text = text + randomChars[num];
            }
            return text;
        }
        #endregion

        #region 判断指定字符串在指定字符串数组中的位置
        /// <summary>
        /// 判断指定字符串在指定字符串数组中的位置
        /// </summary>
        /// <param name="strSearch">字符串</param>
        /// <param name="stringArray">字符串数组</param>
        /// <param name="caseInsensetive">是否不区分大小写, true为不区分, false为区分</param>
        /// <returns>字符串在指定字符串数组中的位置, 如不存在则返回-1</returns>
        public static int GetInArrayID(string strSearch, string[] stringArray, bool caseInsensetive)
        {
            for (int i = 0; i < stringArray.Length; i++)
            {
                if (caseInsensetive)
                {
                    if (strSearch.ToLower() == stringArray[i].ToLower())
                    {
                        return i;
                    }
                }
                else
                {
                    if (strSearch == stringArray[i])
                    {
                        return i;
                    }
                }

            }
            return -1;
        }
        #endregion

        #region 判断指定字符串在指定字符串数组中的位置
        /// <summary>
        /// 判断指定字符串在指定字符串数组中的位置
        /// </summary>
        /// <param name="strSearch">字符串</param>
        /// <param name="stringArray">字符串数组</param>
        /// <returns>字符串在指定字符串数组中的位置, 如不存在则返回-1</returns>		
        public static int GetInArrayID(string strSearch, string[] stringArray)
        {
            return GetInArrayID(strSearch, stringArray, true);
        }
        #endregion

        #region 清除给定字符串中的回车及换行符
        /// <summary>
        /// 清除给定字符串中的回车及换行符
        /// </summary>
        /// <param name="str">要清除的字符串</param>
        /// <returns>清除后返回的字符串</returns>
        public static string ClearBR(string str)
        {
            Regex r = null;
            Match m = null;

            r = new Regex(@"(\r\n)", RegexOptions.IgnoreCase);
            for (m = r.Match(str); m.Success; m = m.NextMatch())
            {
                str = str.Replace(m.Groups[0].ToString(), "");
            }


            return str;
        }
        #endregion

        #region 从字符串的指定位置截取指定长度的子字符串
        /// <summary>
        /// 从字符串的指定位置截取指定长度的子字符串
        /// </summary>
        /// <param name="str">原字符串</param>
        /// <param name="startIndex">子字符串的起始位置</param>
        /// <param name="length">子字符串的长度</param>
        /// <returns>子字符串</returns>
        public static string CutString(string str, int startIndex, int length)
        {
            if (startIndex >= 0)
            {
                if (length < 0)
                {
                    length = length * -1;
                    if (startIndex - length < 0)
                    {
                        length = startIndex;
                        startIndex = 0;
                    }
                    else
                    {
                        startIndex = startIndex - length;
                    }
                }


                if (startIndex > str.Length)
                {
                    return "";
                }


            }
            else
            {
                if (length < 0)
                {
                    return "";
                }
                else
                {
                    if (length + startIndex > 0)
                    {
                        length = length + startIndex;
                        startIndex = 0;
                    }
                    else
                    {
                        return "";
                    }
                }
            }

            if (str.Length - startIndex < length)
            {
                length = str.Length - startIndex;
            }

            try
            {
                return str.Substring(startIndex, length);
            }
            catch
            {
                return str;
            }
        }

        #endregion

        #region 从字符串的指定位置截取指定长度的子字符串
        /// <summary>
        /// 从字符串的指定位置开始截取到字符串结尾的了符串
        /// </summary>
        /// <param name="str">原字符串</param>
        /// <param name="startIndex">子字符串的起始位置</param>
        /// <returns>子字符串</returns>
        public static string CutString(string str, int startIndex)
        {
            return CutString(str, startIndex, str.Length);
        }
        #endregion

        #region 生成指定数量的html空格符号
        /// <summary>
        /// 生成指定数量的html空格符号
        /// </summary>
        /// <param name="spaceCount">空格数</param>
        /// <returns></returns>
        public static string Spaces(int spaceCount)
        {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < spaceCount; i++)
            {
                sb.Append(" &nbsp;&nbsp;");
            }
            return sb.ToString();
        }
        #endregion

        #region 获取某个Email服务器名
        /// <summary>
        /// 获取某个Email服务器名
        /// </summary>
        /// <param name="strEmail">Email地址</param>
        /// <returns></returns>
        public static string GetEmailHostName(string emailAddress)
        {
            if (emailAddress.IndexOf("@") < 0)
            {
                return "";
            }
            return emailAddress.Substring(emailAddress.LastIndexOf("@")).ToLower();
        }
        #endregion

        #region 返回URL中结尾的文件名
        /// <summary>
        /// 返回URL中结尾的文件名
        /// </summary>
        /// <param name="url">Url地址</param>
        /// <returns></returns>
        public static string GetFileName(string url)
        {
            if (url == null)
            {
                return "";
            }
            string[] strs1 = url.Split(new char[] { '/' });
            return strs1[strs1.Length - 1].Split(new char[] { '?' })[0];
        }
        #endregion

        #region 根据阿拉伯数字返回月份的名称(可更改为某种语言)
        /// <summary>
        /// 根据阿拉伯数字返回月份的名称(可更改为某种语言)
        /// </summary>	
        public static string[] Monthes
        {
            get
            {
                return new string[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
            }
        }
        #endregion

        //时间函数

        #region 返回标准日期格式string [yyyy-MM-dd]格式
        /// <summary>
        /// 返回标准日期格式string [yyyy-MM-dd]格式
        /// </summary>
        public static string GetDate()
        {
            return DateTime.Now.ToString("yyyy-MM-dd");
        }
        #endregion

        #region 返回指定日期格式
        /// <summary>
        /// 返回指定日期格式
        /// </summary>
        /// <param name="datetimeStr">时间日期字符串</param>
        /// <param name="replaceStr">如果是1900-01-01 以什么样的字符串进行替换</param>
        /// <returns></returns>
        public static string GetDate(string datetimeStr, string replaceStr)
        {
            if (datetimeStr == null)
            {
                return replaceStr;
            }

            if (datetimeStr.Equals(""))
            {
                return replaceStr;
            }

            try
            {
                datetimeStr = Convert.ToDateTime(datetimeStr).ToString("yyyy-MM-dd").Replace("1900-01-01", replaceStr);
            }
            catch
            {
                return replaceStr;
            }
            return datetimeStr;

        }
        #endregion

        #region 返回标准时间格式string
        /// <summary>
        /// 返回标准时间格式string
        /// </summary>
        public static string GetTime()
        {
            return DateTime.Now.ToString("HH:mm:ss");
        }
        #endregion

        #region 返回标准时间格式string
        /// <summary>
        /// 返回标准时间格式string
        /// </summary>
        public static string GetDateTime()
        {
            return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        }
        #endregion

        #region 返回相对于当前时间的相对天数
        /// <summary>
        /// 返回相对于当前时间的相对天数
        /// </summary>
        /// <param name="relativeDay">相对天的数量</param>
        /// <returns></returns>
        public static string GetDateTime(int relativeDay)
        {
            return DateTime.Now.AddDays(relativeDay).ToString("yyyy-MM-dd HH:mm:ss");
        }
        #endregion

        #region 返回标准时间格式string
        /// <summary>
        /// 返回标准时间格式string[带毫秒]
        /// </summary>
        public static string GetDateTimeF()
        {
            return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fffffff");
        }
        #endregion

        #region 返回标准时间
        /// <summary>
        /// 返回标准时间
        /// </summary>
        /// <param name="fDateTime"></param>
        /// <param name="formatStr"></param>
        /// <returns></returns>
        public static string GetStandardDateTime(string fDateTime, string formatStr)
        {
            DateTime s = Convert.ToDateTime(fDateTime);
            return s.ToString(formatStr);
        }
        #endregion

        #region 返回标准时间 yyyy-MM-dd HH:mm:ss
        /// <summary>
        /// 返回标准时间 yyyy-MM-dd HH:mm:ss
        /// </sumary>
        public static string GetStandardDateTime(string fDateTime)
        {
            return GetStandardDateTime(fDateTime, "yyyy-MM-dd HH:mm:ss");
        }
        #endregion

        //其他

        #region 格式化字节数字符串
        /// <summary>
        /// 格式化字节数字符串
        /// </summary>
        /// <param name="bytes">bytes值</param>
        /// <returns></returns>
        public static string FormatBytesStr(int bytes)
        {
            if (bytes > 1073741824)
            {
                return ((double)(bytes / 1073741824)).ToString("0") + "G";
            }
            if (bytes > 1048576)
            {
                return ((double)(bytes / 1048576)).ToString("0") + "M";
            }
            if (bytes > 1024)
            {
                return ((double)(bytes / 1024)).ToString("0") + "K";
            }
            return bytes.ToString() + "Bytes";
        }
        #endregion

        #region 为脚本替换特殊字符串
        /// <summary>
        /// 为脚本替换特殊字符串
        /// </summary>
        /// <param name="str">脚本字符串</param>
        /// <returns></returns>
        public static string ReplaceStrToScript(string str)
        {
            str = str.Replace("\\", "\\\\");
            str = str.Replace("'", "\\'");
            str = str.Replace("\"", "\\\"");
            return str;
        }
        #endregion

        #region 显示文件大小函数
        /// <summary>
        /// 显示文件大小函数
        /// </summary>
        /// <param name="pSize">原始的数值(字节)</param>
        /// <returns>转化后数值(自动匹配)</returns>
        public static string DisplayFileSize(Int64 pSize)
        {
            //初始化
            float FloSize = pSize;
            string StrSize;

            //小于1K，则显示单位为字节
            if (pSize < 1024)
            {
                StrSize = pSize.ToString();
                return StrSize + "字节";
            }

            //大于1K，则显示单位为KB
            else if ((pSize >= 1024) && (pSize <= 1048576))
            {
                FloSize = FloSize / 1024;
                StrSize = string.Format("{0:F2}", FloSize);
                return StrSize + "KB";
            }

            //大于1M，则显示单位为MB
            else if ((pSize >= 1048576) && (pSize <= 1073741824))
            {
                FloSize = FloSize / 1048576;
                StrSize = string.Format("{0:F2}", FloSize);
                return StrSize + "MB";
            }

            //大于1G，则显示单位为G
            else if (pSize >= 1073741824)
            {
                FloSize = FloSize / 1073741824;
                StrSize = string.Format("{0:F2}", FloSize);
                return StrSize + "GB";
            }
            return string.Empty;
        }
        #endregion



        //xml中特殊字符的转换
        #region 带XML文档的请求特殊字符处理,转义如& ,>,<等特殊字符
        /// <summary>
        /// 将& &lt &gt 关键字转换 用户写入xml文档时，对关键字进行过滤
        /// </summary>
        /// <param name="xml">要过滤的xml节点内空或属性内容字符串</param>
        /// <returns>过滤后的xml文档</returns>
        /// <remarks></remarks>
        public static string KeyWordHandler(string xml)
        {
            string result = string.Empty;
            result = xml.Replace("&", "&amp;").Replace(">", "&gt;").Replace("<", "&lt;").ToString();
            return result;
        }
        #endregion

        #region 将关键字转换还原
        /// <summary>
        /// 将关键字`转换还原 关键字转换 用于读取xml文档时，对取得的节点内容和属性值进行还原
        /// </summary>
        /// <param name="xml">待还原的 xml节点的内空或属性内容</param>
        /// <returns>还原后的xml内容</returns>
        /// <remarks></remarks>
        public static string KeyWordReversion(string xml)
        {
            string result = string.Empty;
            result = xml.Replace("&amp;", "&").Replace("&gt;", ">").Replace("&lt;", "<").ToString();
            return result;
        }
        #endregion

        //参数标识解析函数

        #region 状态参数标识解析函数
        /// <summary>
        /// 状态参数标识解析函数
        /// </summary>
        /// <param name="pCodeID">参数标识</param>
        /// <returns>结果字符串</returns>
        public static string StateCodeIDParse(int pCodeID)
        {
            switch (pCodeID)
            {
                case 0:
                    return "禁用";
                case 1:
                    return "启用";
                default:
                    return "其他";
            }
        }
        #endregion

        //JSON序列化使用函数
        #region 转义会影响JSON结构的字符串
        /// <summary>
        /// 转义会影响JSON结构的字符串
        /// </summary>
        /// <returns></returns>
        public static string FixJSONString(string str)
        {
            if (str == null) return String.Empty;
            return str
                .Replace("\r", "")
                .Replace("\n", "")
                .Replace("\"", "\\\"")
                .Replace("'", "\\'")
                .Replace(":", "\\:")
                .Replace("(", "\\(")
                .Replace(")", "\\)")
                .Replace("{", "\\{")
                .Replace("}", "\\}");
        }
        #endregion

        #region 时间转换成多少分钟前
        /// <summary>
        /// 时间转换成多少分钟前
        /// </summary>
        /// <param name="dateTime">原来时间</param>
        /// <returns>转换后的时间</returns>
        public static string ToTimeString(DateTime dateTime)
        {
            bool hasPre = false;
            TimeSpan ts = DateTime.Now - dateTime;
            string s = "";
            if (ts.Days >= 1)
            {
                s += ts.Days + "天";
                //                ts = ts - new TimeSpan(ts.Days, 0, 0, 0);
                return s + "前";
            }

            if (ts.Hours >= 1)
            {
                s += ts.Hours + "小时";
                ts = ts - new TimeSpan(ts.Hours, 0, 0);
                hasPre = true;
            }
            if (ts.Minutes >= 1)
            {
                s += ts.Minutes + "分钟";
                //                hasPre = true;
            }
            else
                if (hasPre)
                    s += "0分钟";

            s += "前";
            return s;
        }
        #endregion

        #region 获取模计算值
        /// <summary>
        /// 获取公会文章具体取自哪张表的数据和存储在哪张表中
        /// </summary>
        /// <param name="divisor">除数</param>
        /// <param name="dividend">被除数</param>
        /// <returns></returns>
        public static string GetIndexMod(int divisor, int dividend)
        {
            int modResult = 0;
            modResult = (divisor % dividend);
            if (modResult == 0)
            {
                modResult = dividend;
            }
            return string.Format("{0:D3}", modResult);
        }
        #endregion

        #region 获取模计算值
        /// <summary>
        /// 获取公会文章具体取自哪张表的数据和存储在哪张表中
        /// </summary>
        /// <param name="divisor">除数</param>
        /// <param name="dividend">被除数</param>
        /// <param name="formatRegex">输出所按格式</param>
        /// <returns></returns>
        public static string GetIndexMod(int divisor, int dividend, string formatRegex)
        {
            int modResult = 0;
            modResult = (divisor % dividend);
            if (modResult == 0)
            {
                modResult = dividend;
            }
            return string.Format(formatRegex, modResult);
        }
        #endregion



        //
        public static string ArrayToString(Array array, string splitChar)
        {
            if (array != null && array.Length > 0)
            {
                string result = "";
                foreach (string item in array)
                {
                    result += item.ToString() + splitChar;
                }

                result.Trim(',');

                return result;
            }
            else
            {
                return string.Empty;
            }
        }

        public static string ArrayToString(Array array)
        {
            return ArrayToString(array, ",");
        }




        #region 身份证验证方法 - by YH
        /// <summary>
        /// 身份证验证方法
        /// </summary>
        /// <param name="Id">15或18位身份证</param>
        /// <returns>bool</returns>
        public static bool CheckIDCard(string Id)
        {
            if (Id.Length == 18)
            {
                bool check = CheckIDCard18(Id);
                return check;
            }
            else if (Id.Length == 15)
            {
                bool check = CheckIDCard15(Id);
                return check;
            }
            else
            {
                return false;
            }
        }

        private static bool CheckIDCard18(string Id)
        {
            long n = 0;
            if (long.TryParse(Id.Remove(17), out n) == false || n < Math.Pow(10, 16) || long.TryParse(Id.Replace('x', '0').Replace('X', '0'), out n) == false)
            {
                return false;//数字验证
            }
            string address = "11x22x35x44x53x12x23x36x45x54x13x31x37x46x61x14x32x41x50x62x15x33x42x51x63x21x34x43x52x64x65x71x81x82x91";
            if (address.IndexOf(Id.Remove(2)) == -1)
            {
                return false;//省份验证
            }
            string birth = Id.Substring(6, 8).Insert(6, "-").Insert(4, "-");
            DateTime time = new DateTime();
            if (DateTime.TryParse(birth, out time) == false)
            {
                return false;//生日验证
            }
            string[] arrVarifyCode = ("1,0,x,9,8,7,6,5,4,3,2").Split(',');
            string[] Wi = ("7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2").Split(',');
            char[] Ai = Id.Remove(17).ToCharArray();
            int sum = 0;
            for (int i = 0; i < 17; i++)
            {
                sum += int.Parse(Wi[i]) * int.Parse(Ai[i].ToString());
            }
            int y = -1;
            Math.DivRem(sum, 11, out y);
            if (arrVarifyCode[y] != Id.Substring(17, 1).ToLower())
            {
                return false;//校验码验证
            }
            return true;//符合GB11643-1999标准
        }

        private static bool CheckIDCard15(string Id)
        {
            long n = 0;
            if (long.TryParse(Id, out n) == false || n < Math.Pow(10, 14))
            {
                return false;//数字验证
            }
            string address = "11x22x35x44x53x12x23x36x45x54x13x31x37x46x61x14x32x41x50x62x15x33x42x51x63x21x34x43x52x64x65x71x81x82x91";
            if (address.IndexOf(Id.Remove(2)) == -1)
            {
                return false;//省份验证
            }
            string birth = Id.Substring(6, 6).Insert(4, "-").Insert(2, "-");
            DateTime time = new DateTime();
            if (DateTime.TryParse(birth, out time) == false)
            {
                return false;//生日验证
            }
            return true;//符合15位身份证标准
        }
        #endregion

    }
}